﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MachineKeyGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            var rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
            byte[] validationKey = new byte[64];
            byte[] decryptionKey = new byte[24];
            rng.GetBytes(validationKey);
            rng.GetBytes(decryptionKey);
            Console.WriteLine("ValidationKey:");
            Console.WriteLine(FormatHexBytes(validationKey));
            Console.WriteLine("DecryptionKey:");
            Console.WriteLine(FormatHexBytes(decryptionKey));
            Console.ReadLine();
        }

        private static string FormatHexBytes(IEnumerable<byte> bytes)
        {
            var sb  = new StringBuilder();
            foreach (var b in bytes)
            {
                sb.AppendFormat("{0:x2}", b);
            }
            return sb.ToString();
        }
    }
}
